package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppCustomerEncryptionKey;
import com.ep.modules.app.service.AppCustomerEncryptionKeyService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/customer_encryption_key")
public class AppCustomerEncryptionKeyController {
    @Autowired
    private AppCustomerEncryptionKeyService appCustomerEncryptionKeyService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appCustomerEncryptionKeyService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppCustomerEncryptionKey appcustomerencryptionkey = appCustomerEncryptionKeyService.getById(id);
        return R.ok().put("appcustomerencryptionkey", appcustomerencryptionkey);
    }

    @SysLog("保存AppCustomerEncryptionKey")
    @PostMapping("/save")
    public R save(@RequestBody AppCustomerEncryptionKey appcustomerencryptionkey) {
        ValidatorUtils.validateEntity(appcustomerencryptionkey);
        appCustomerEncryptionKeyService.save(appcustomerencryptionkey);
        return R.ok();
    }

    @SysLog("修改AppCustomerEncryptionKey")
    @PostMapping("/update")
    public R update(@RequestBody AppCustomerEncryptionKey appcustomerencryptionkey) {
        ValidatorUtils.validateEntity(appcustomerencryptionkey);
        appCustomerEncryptionKeyService.update(appcustomerencryptionkey);
        return R.ok();
    }

    @SysLog("删除AppCustomerEncryptionKey")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appCustomerEncryptionKeyService.deleteBatch(ids);
        return R.ok();
    }
}